package Aop.Element;

public class Vector
{
	private double m_x, m_y;
	
	public Vector()
	{
		m_x = 0;
		m_y = 0;
	}
	public Vector(int x, int y)
	{
		m_x = x;
		m_y = y;
	}
	public Vector(double x, double y)
	{
		m_x = x;
		m_y = y;
	}
	
	public double Distance(Vector $operand)
	{
		double result = 0;
		
		result = Math.sqrt(Math.pow(m_x - $operand.GetX(), 2) + Math.pow(m_y - $operand.GetY(), 2));
		
		return result;
	}
	
	public Vector Sum(Vector $operand)
	{
		Vector result = new Vector(0, 0);
		result.SetX(m_x + $operand.GetX());
		result.SetY(m_y + $operand.GetY());
		
		return result;
	}
	
	public Vector Subtract(Vector $operand)
	{
		Vector result = new Vector();
		result.SetX(m_x - $operand.GetX());
		result.SetY(m_y - $operand.GetY());
		
		return result;
	}
	
	public boolean isEqual(Vector $comapred)
	{
		boolean result = true;
		
		if(m_x != $comapred.GetX() || m_y != $comapred.GetY()) result = false;
		
		return result;
	}
	
	public double GetX() { return m_x; }
	public double GetY() { return m_y; }
	
	public void SetX(double x) { m_x = x; }
	public void SetY(double y) { m_y = y; }
	
	static public Vector Zero()
	{
		Vector result = new Vector(0, 0);
		
		return result;
	}
}